<?php
/**
 * @file additional.php
 *
 * Additional functions for developing.
 *
 * Some more functions for easy development with PHP and even the
 * rpd-Framework.
 *
 * http://code.google.com/p/rpd/wiki/additional.php
 *
 * New BSD License
 * \n
 * Copyright (c) 2010 Rpd-Team
 *
 * @namespace  rpd
 * @since      0.0.1
 * @version    0.0.1
 */

/**
 *
 */
function dump($var = NULL)
{
	$a = debug_backtrace();
	// file
	$file = str_replace("\\", "/", $a[0]["file"]);
	$file = str_replace($_SERVER["DOCUMENT_ROOT"], "", $file);
	// line
	$line = $a[0]["line"];

	if (func_num_args() == 0)
	{
		$open = true;
	}
	else
	{
		ob_start("htmlspecialchars");
		$args = func_get_args();
		$i = count($args);
		foreach (func_get_args() as $arg)
		{
			var_dump($arg);
			if (--$i > 0) include "rpd/_internalViews/dump-seperator.phtml";
		}
		$dump = ob_get_clean();
	}
	
	include("rpd/_internalViews/dump.phtml");
}

function print_backtrace()
{
	echo "<pre>";
	debug_print_backtrace();
	echo "</pre>";
}

?>